package com.ybb.service;

import com.ybb.dao.UserDao;
import com.ybb.dao.UserDaoImpl;
import com.ybb.pojo.User;

import java.util.List;

public class UserServiceImpl implements UserService {
  private UserDao userDao=null;

    public UserServiceImpl() {
        userDao =new UserDaoImpl();
    }

    @Override
    public int updatePassword(Long id, String oldPassword, String newPassword) {
        return userDao.updatePassword(id,oldPassword,newPassword);
    }

    @Override
    public List<User> getUsers(String queryName,long queryUserRole,int currentPageNum,int userCountPerPage) {
        return userDao.getUsers(queryName,queryUserRole,currentPageNum,userCountPerPage);
    }

    @Override
    public  int getUsersCount(String queryName,long queryUserRole){
        return userDao.getUsersCount(queryName,queryUserRole);
    }

    @Override
    public User getUserById(long uid) {
        return userDao.getUserById(uid);
    }

    @Override
    public int upDateUser(User user) {
        return userDao.upDateUser(user);
    }

    @Override
    public int deleteUser(long uid) {
        return userDao.deleteUser(uid);
    }

    @Override
    public boolean isExists(long uid) {
        return userDao.isExists(uid);
    }

    @Override
    public boolean hasUserCode(String userCode) {
        return userDao.hasUserCode(userCode);
    }

    @Override
    public int insertUser(User user) {
        return userDao.insertUser(user);
    }
}
